package com.destinomusical.epura;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.destinomusical.epura.base.BaseActivity;
import com.destinomusical.epura.obj.Usuario;
import com.smartthinking.destinomusical.R;

public class Configuracion extends BaseActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.configuracion);
		setTopBar(0, 0, R.string.boton_configuracion);
	}

	public void onClickButtonPreguntasFrecuentes(View view) {

		startActivity(new Intent(getApplicationContext(),
				PreguntasFrecuentes.class));

	}

	public void onClickButtonMiCuenta(View view) {
		if (usuario.isLogged() == 1) {
			Intent intent = new Intent(getApplicationContext(), MiCuenta.class);
			intent.putExtra("usuario", usuario);
			startActivityForResult(intent, 2);
		} else {
			Toast.makeText(getApplicationContext(),
					getString(R.string.msg_login), Toast.LENGTH_SHORT).show();
		}

	}
	

	public void onClickButtonContactos(View view) {

		Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
		String aEmailList[] = { "info@destinomusical.com" };
		emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);
		emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Contacto-Android");
		emailIntent.setType("plain/text");
		startActivity(Intent.createChooser(emailIntent,
				"Selecciona el cliente de correo:"));

	}

	public void onClickButtonPoliticas(View view) {

		startActivity(new Intent(getApplicationContext(),
				PoliticasPrivacidad.class));

	}
	
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		if (requestCode == 2 && data != null) {
			Usuario temp =data.getParcelableExtra("usuario");
			usuario = temp;
			Intent in = new Intent();
			in.putExtra("usuario", usuario );
			setResult(2, in);
		}
	}

}